<template>
  <view class="vc" @click="navTo(url)"><slot></slot></view>
</template>

<script>
import { mapState } from 'vuex'
export default {
  props: {
    url: {
      type: String,
      default: ''
    }
  },
	options: { styleIsolation: 'shared' },
  computed: {
    ...mapState(['hasLogin'])
  },
  methods: {
    navTo(url){
      if(!url) return
      if(!this.hasLogin&&url!==this.loginUrl){
        this.$api.msg('登录解锁更多功能！')
        setTimeout(() => {
          uni.navigateTo({ url:this.loginUrl })
        }, 1000);
      } else {
        uni.navigateTo({ url }) 
      }
    }
  }
}
</script>